home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / mildred / lha / mscreen.lha / SMR.ascii < prev    next >
Text File  |  1999-01-09  |  4KB  |  116 lines

  1.  
  2. #DTAG_DISP=$80000000
  3. #DTAG_DIMS=$80001000
  4. #DTAG_MNTR=$80002000
  5. #DTAG_NAME=$80003000
  6.  
  7. NEWTYPE.SMode
  8.   DID.l
  9.   DWidth.l
  10.   DHeight.l
  11.   DDepth.w
  12.   DType.w
  13. End NEWTYPE
  14.  
  15. DEFTYPE.Hook myhook ; The hook for ASL tag as &myhook
  16. myhook\h_Entry=?hook
  17. MOVE.l a5,globalbase
  18. funcret.l=0
  19.  
  20. Dim SMRtags.TagItem(17)
  21. SMRtags(0)\ti_Tag=#ASLSM_InitialLeftEdge,160 ; X coord of requester
  22. SMRtags(1)\ti_Tag=#ASLSM_InitialTopEdge,0 ; Y coord of requester
  23. SMRtags(2)\ti_Tag=#ASLSM_InitialWidth,300 ; Width of requester
  24. SMRtags(3)\ti_Tag=#ASLSM_InitialHeight,400 ; Height of requester
  25. SMRtags(4)\ti_Tag=#ASLSM_InitialDisplayID,$21000 ; Default ModeID (Pal:LowRes)
  26. SMRtags(5)\ti_Tag=#ASLSM_InitialDisplayDepth,8 ; Default depth (8-bit usually)
  27. SMRtags(6)\ti_Tag=#ASLSM_InitialDisplayWidth,PrefDisplayWidth
  28. SMRtags(7)\ti_Tag=#ASLSM_InitialDisplayHeight,PrefDisplayHeight
  29. SMRtags(8)\ti_Tag=#ASLSM_InitialOverscanType,1 ; Default overscan type (Text)
  30. SMRtags(9)\ti_Tag=#ASLSM_InitialInfoOpened,1 ; Info window?
  31. SMRtags(10)\ti_Tag=#ASLSM_InitialInfoLeftEdge,350 ; X coord of info window
  32. SMRtags(11)\ti_Tag=#ASLSM_InitialInfoTopEdge,50 ; Y coord of info window
  33. SMRtags(12)\ti_Tag=#ASLSM_DoDepth,0 ; Depth gadget? (Generally NO for chunky 8-bit)
  34. SMRtags(13)\ti_Tag=#ASLSM_DoOverscanType,1 ; Overscan gadget?
  35. SMRtags(14)\ti_Tag=#ASLSM_DoWidth,1 ; Width gadget?
  36. SMRtags(15)\ti_Tag=#ASLSM_DoHeight,1 ; Height gadget?
  37. SMRtags(16)\ti_Tag=#ASLSM_FilterFunc,&myhook ; Address of callback hook routine
  38. SMRtags(17)\ti_Tag=#TAG_DONE,0
  39.  
  40. *sreq.SMode=0
  41. *sreq=AllocAslRequest_(2,&SMRtags(0)\ti_Tag)
  42. ok.b=AslRequest_(*sreq,&SMRtags(0)\ti_Tag)
  43.  
  44. If ok<>0
  45.   PrefDisplayID.l=*sreq\DID
  46.   PrefDisplayWidth.w=*sreq\DWidth
  47.   PrefDisplayHeight.w=*sreq\DHeight
  48. EndIf
  49. If (*sreq) Then FreeAslRequest_(*sreq)
  50.  
  51. Goto PrefsSkip
  52.  
  53. ;*************************************************************************
  54. ; This is the statement that the hook will call.  Put the label before
  55. ; the statement you want to jump to.
  56. Runerrsoff
  57. .hook_jump:
  58. Statement hook{*dahook.Hook, modeID.l, *smr.ScreenModeRequester}
  59.   ; We're inside the hook, and supposedly we should be able to do whatever
  60.   ; we want.
  61.   ; Filter modeID's here
  62.   SHARED funcret.l,SMRMinX,SMRMinY,SMRMaxX,SMRMaxY
  63.   DEFTYPE.DisplayInfo DisInfoBuf
  64.   DEFTYPE.DimensionInfo DimInfoBuf
  65.   DEFTYPE.MonitorInfo MonInfoBuf
  66.   DEFTYPE.NameInfo NamInfoBuf
  67.   ;Refer to Includes/Graphics/DisplayInfo.h or view newtypes
  68.   IDhandle.l=FindDisplayInfo_(modeID)
  69.   GetDisplayInfoData_ IDhandle,&DisInfoBuf,SizeOf.DisplayInfo,#DTAG_DISP,0
  70.   GetDisplayInfoData_ IDhandle,&DimInfoBuf,SizeOf.DimensionInfo,#DTAG_DIMS,0
  71.   GetDisplayInfoData_ IDhandle,&MonInfoBuf,SizeOf.MonitorInfo,#DTAG_MNTR,0
  72.   GetDisplayInfoData_ IDhandle,&NamInfoBuf,SizeOf.NameInfo,#DTAG_NAME,0
  73.   ;Do tests. True=Mode is valid, False=mode is invalid.
  74.   ;See newtypes for DisplayInfo,DimensionInfo,MonitorInfo and NameInfo for things to further test
  75.   If DimInfoBuf\MaxDepth<>8
  76.     ;No true-colour modes, only 8-bit
  77.     funcret=False
  78.   Else
  79.     funcret=True
  80.   EndIf
  81. End Statement
  82.  
  83. ;**********************
  84. ; Hook
  85. Macro goto_hook
  86.   JSR `1+6
  87. End Macro
  88.  
  89. globalbase: Dc.l 0
  90.  
  91. hook: ;This hook is called by the filter hook callback from screenmode requester, per item
  92. ; Store registers
  93. MOVEM.l   d1-d7/a0-a6,-(a7) ; Not d0!
  94.  
  95. ; Put parameters into dregs ready for a statement
  96. MOVE.l    a0,d0
  97. MOVE.l    a1,d1
  98. MOVE.l    a2,d2
  99.  
  100. ; Get global variable base
  101. MOVE.l    globalbase,a5
  102.  
  103. ; Goto hook statement
  104. !goto_hook{hook_jump}
  105.  
  106. GetReg d0,funcret ; return accept/discard
  107.  
  108. ; Restore registers
  109. MOVEM.l   (a7)+,d1-d7/a0-a6 ; Not d0!
  110.  
  111. RTS
  112. ;**********************
  113.  
  114. Runerrson
  115. PrefsSkip
  116.